package com.controller.manager;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.po.MessageBeanW;
import com.service.manager.MessageServiceW;

@Controller
@RequestMapping("/jsp")
public class MessageControllerW {

	@Resource(name="messageServiceImpW")
	private MessageServiceW messageService;
	
	@ResponseBody
	@RequestMapping(value="/getMessageList")
	public List<MessageBeanW> getMessageList(MessageBeanW message,Integer page,Integer rows){
		
		message.setPage((page-1)*rows);
		message.setRows(rows);
		List<MessageBeanW> list = messageService.getMessageList(message);
		return list;
	}
	
	@ResponseBody
	@RequestMapping(value="/delMessage")
	public int delMessage(String messageids){
		
		String[] array = messageids.split(",");
		int result = messageService.delMessage(array);
		return result;
	}
	
	@ResponseBody
	@RequestMapping(value="/updateMessage")
	public int updateMessage(MessageBeanW message){
		
		int result = messageService.updateMessage(message);
		return result;
	}
}
